<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Button Component</title>
  <style>
    button {
      margin: 10px;
    }
  </style>
</head>

<body>
  <div id="button">
    <button onclick="acceptCall()">接听</button>
    <button onclick="hangupCall()">挂断</button>
  </div>

  <script>
    function acceptCall() {
      // 触发接听事件
      var event = new Event('accept');
      document.getElementById('button').dispatchEvent(event);
    }

    function hangupCall() {
      // 触发挂断事件
      var event = new Event('hangup');
      document.getElementById('button').dispatchEvent(event);
    }
  </script>
</body>

</html>
